package day.day7_14;
import java.util.*;
public class Main
{
    //暴力算法求取因数
    public static int calPerfectNum(int num)
    {
        int count = 0;
        for(int i =1; i<num; i++)
        {
            int sum = 0;
            for(int j =1; j<=i/2; j++)
            {
                if(i%j==0)
                {
                    sum += j;
                }
            }

            if(sum == i)
            {
                count++;
            }
        }

        return count;
    }
    public static  void main(String []args)
    {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt())
        {
            int num = sc.nextInt();
            int res = calPerfectNum(num);
            System.out.println(res);
        }
    }
}
